<?php
namespace app\api\controller;
use app\api\model\Banner;
use app\api\model\Goods;
use think\Controller;
use think\Request;


//首页
class Index extends Common
{
    // banner
    public function getBannerList(){

        to_json_encode(200,'success',Banner::handleBannerList(Banner::getBannerList()));

    }

    // 商品列表
    
    public function getGoodsList(Request $request){

        $user_id = $this->checkLoginUser();
       // $user_id =74;
        $page = $request->param('page',1);
        $cate = $request->param('goods_cate',0);
        to_json_encode(200,'success',Goods::handleGoodsList(Goods::getGoodsList($cate,$page,Goods::GOODS_WEIXIN_PUB),$user_id));

    }

    //商品分类列表
    public function getGoodsCateList(Request $request)
    {
        to_json_encode(200,'success',Goods::getGoodsCateList(Goods::GOODS_WEIXIN_PUB));

    }
    
}
